<?php
    include('session.inc');
    require_once('funct.inc');
    if(!GetAdminID($ID)){echo LOGIN_ERR;exit;}
    if(!Right_Check(1)){header('Location:error.php');exit;}
    include 'color_style.php';
    include LANGUAGE;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
        <?php echo '<meta http-equiv="Content-Type" content="text/html; charset='._CHARSET_.';">'; ?>

        <style  type="text/css"><!--
                table{
                        border-bottom-color: white;
                        border-top-color: black;
                        border-left-color: white;
                        border-right-color: white;
                        border-collapse: collapse;
                }
                input {
                        border: 0px;
                        cursor: hand;
                        height: 15px;
                        background-color: transparent;
                        font-size: 10px;
                        margin-left: 0px;
                        padding-left: 0px;
                        list-style-type: none;
                        font-family:  Verdana;
                        text-align:left;
                        margin-top:0pt;
                        margin-bottom:0px;
                }
                form {margin-top:0pt; margin-bottom:0px;}
                img {margin-top:0pt; margin-bottom:0px;}
                body{
                        margin-left:0pt;
                        margin-right:0pt;
                        margin-top:0pt;
                        margin-bottom:0pt;
                        background-position:  15px 70px;
                        background-repeat:    no-repeat;
                        font-size: 10px;
                        font-family:  Verdana;
                }


        --></style>
</head>

<?php
print "<body  bgcolor=\"".Background_Color."\">
<table border=\"0\" cellpadding=\"1\" cellspacing=\"0\" >
<tr><td>";// background=\"brush.jpg\"



        require_once('OpenDB.inc');
        require_once('functs.inc');
        if (!OpenDB()){echo OPEN_DB_ERR; break;}

        $roll_menu=rutine_menu($_REQUEST["roll_menu"],$_REQUEST["ID"]);
		
        //vyhladavanie
         print "
               <b><font size=\"1\" face=\"Verdana\">".M_VYHLADAT.":</font></b>
               <form action=\"adm_contents.php\" target=\"contents\" method=\"post\">
                    <input type=\"text\" name=\"Search_Value\" style=\"width:100px; border:1px solid black; position:absolute; left:5px; top:25px;\">
                    <input type=\"submit\" value=\"".M_HLADAJ."\" style=\"width :40px;position:absolute; left:110px; top:25px;\"
                        onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bolder';\"
                        onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" 
                    />
               </form>";

        //akcie, vypredaj, novinky
        print "
            <br />
            <br />
            <b><font size=\"1\" face=\"Verdana\">".M_SKUPINY_PRODUKTOV.":</font></b>
            <form action=\"adm_contents.php\" target=\"contents\" method=\"post\">
                <input type=\"hidden\" value=\"-1\" name=\"ID\" />
                <input type=\"submit\" value=\"".M_AKCIE."\" style=\"width :150px;position:relative; left:0px; top:5px; border:1px solid black;\"
                    onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bolder';\"
                    onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\"
                />
            </form>
            <form action=\"adm_contents.php\" target=\"contents\" method=\"post\">
                <input type=\"hidden\" value=\"-2\" name=\"ID\" />
                <input type=\"submit\" value=\"".M_NOVINKY."\" style=\"width :150px;position:relative; left:0px; top:5px; border:1px solid black;\"
                    onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bolder';\"
                    onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\"
                />
            </form>
            <form action=\"adm_contents.php\" target=\"contents\" method=\"post\">
                <input type=\"hidden\" value=\"-3\" name=\"ID\" />
                <input type=\"submit\" value=\"".M_VYPREDAJ."\" style=\"width :150px;position:relative; left:0px; top:5px; border:1px solid black;\"
                    onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bolder';\"
                    onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\"
                />
            </form>
        ";

        print "
            <br />
            <b><font size=\"1\" face=\"Verdana\">".M_KATEGORIE_PRODUKTOV.":</font></b>
            <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"position:relative; left:0px; top:5px;\">
        ";
        //**********************************************************************
        //
        //ROZROLOVANIE MENU PRI VYKRESLOVANI STRANKY - TOP MENU
        //
        //**********************************************************************
        $sql_topmnu= "SELECT * FROM top_category ORDER BY TC_Order";
        $TMnu_Source=mysql_query($sql_topmnu);
        while($sql_array_TMnu = mysql_fetch_object($TMnu_Source))
          {

                print "<tr>";
		print "<td background=\"tien_menu_static.bmp\" style=\"background-repeat:repeat-x;background-position:0px 0px;\">"; //colspan

                //print "<td colspan=\"2\">";

                if($sql_array_TMnu->TC_Have_SC==1){  //ak existuje podmenu - form odkazuje na svoju vlastnu stranku, do ktorej sa zaznamena ID Top menu
                    print "<form action=\"adm_menu.php\" method=\"post\">";
                    print "<input type=\"hidden\" value=\"".$sql_array_TMnu->ID."\" NAME=\"ID\" />";
                }
                else                                //ak neexistuje podmenu
                {
                    $sql_submnu= "SELECT * FROM sub_category WHERE TC_ID=".$sql_array_TMnu->ID." ORDER BY SC_Order";
                    $SMnu_Source=mysql_query("$sql_submnu");
                    $sql_array_SMnu = mysql_fetch_object($SMnu_Source);
                    print "<form action=\"adm_contents.php\" target=\"contents\" method=\"post\">";
                    print "<input type=\"hidden\" value=\"".$sql_array_SMnu->ID."\" name=\"ID\" />";
                    print "<input type=\"hidden\" value=\"".$sql_array_TMnu->TC_Caption."\" name=\"path\" />";
                }

                //nastavenie tlacitka
                print "<input type=\"submit\" value=\"".$sql_array_TMnu->TC_Caption."\" style=\"width :150px\";";
                print " onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bolder';\"";
                print " onmouseout=\"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />";

                print "<input type=\"hidden\" value=\"".$roll_menu."\" name=\"roll_menu\" />";

                print "</form>";
                print "</td>";
                print "</tr>";

                //**************************************************************
                //
                //ak existuje SUB MENU a je rozrolovane
                //
                //**************************************************************
                //tu sa vytvara zoznam formularov - zobrazenych ako podmenu, ktore
                //po kliknuti na tlacitko odosielaju udaje do formulara "products.php"
                 if(is_roll($roll_menu,$sql_array_TMnu->ID))
                 {
                  $sql_submnu= "SELECT * FROM sub_category WHERE TC_ID=".$sql_array_TMnu->ID." ORDER BY SC_Order";
                  $SMnu_Source=mysql_query("$sql_submnu");
                   while($sql_array_SMnu = mysql_fetch_object($SMnu_Source))
                   {
                      print "<tr>";
                            print "<td align=\"right\" background=\"tien_menu_roll_down.bmp\" style=\"background-repeat:repeat;background-position:0px 0px;\">";
                                print "<form action=\"adm_contents.php\" target=\"contents\" method=\"post\">";
                                    print "<input type=\"submit\" value=\"".$sql_array_SMnu->SC_Caption."\" style=\"width :135px\";";
                                        print " onmouseover=\"this.style.backgroundColor='".BUTTON_ON_OVER."'; this.style.fontWeight='bold';\"";
                                        print " onmouseout= \"this.style.backgroundColor='".BUTTON_ON_OUT."'; this.style.fontWeight='normal';\" />";
                                    print "<input type=\"hidden\" value=\"".$sql_array_SMnu->ID."\" name=\"ID\" />";
                                    print "<input type=\"hidden\" value=\"".$sql_array_TMnu->TC_Caption." - ".$sql_array_SMnu->SC_Caption."\" name=\"path\" />";
                                print "</form>";
                              print "</td>";
                      print "</tr>";
                   }
                  }
         }
        mysql_close();
?>
</tr></td>
</table>
</body>
</html>
